<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<%
	String path = request.getContextPath();
%>

<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>Refresh Redis Cache</title>
		
		<script src="<%=path%>/static/js/jquery-1.6.1.min.js" type="text/javascript"></script>
		<script src="<spring:url value="/static/js/jquery.easyui.min.js" />" type="text/javascript" ></script>
		<link rel="stylesheet" type="text/css" href="<%=path%>/static/css/themes/default/easyui.css">
		<link href="<%=path%>/static/css/themes/icon.css" rel="stylesheet" type="text/css" />
		

	<script type="text/javascript">
	
	function redisRefresh(){
		var r = $('#queryForm').form('validate');
		if (!r) {
			return false;
		}
		if($('#idCacheName').combobox('getValue') == undefined){
			$.messager.alert('Prompt', 'Please select cache name.');
			return;
		}
		$.messager.progress({
            title:'Please wait',
            msg:'Data is processing ...',
            text:"Loading..."
        });
		$.post("refreshRedis", $("#queryForm").serializeArray(),
				function(data) {
					$.messager.progress('close');
					$.messager.alert('提示', "刷新完成", 'info');
				});
	}
	
			
        	$.ajaxSetup({
					global : false,
					type : "POST",
					complete : function(XMLHttpRequest, textStatus) {
						var data = XMLHttpRequest.responseText;
						var redirect=window.top.location.host+"/YouLeCloud/login";
						if (data=="timeout") {
							if (window.top != window.self) {
							   window.top.location.href="${redirect}";
							   return;
							   }
						}
					}
				});
        
	</script>
		
	</head>


	<body class="easyui-layout" style="height: 100%">
	
		
		<div data-options="region:'north'" 
			style="padding: 10px; height: 200px;"
			title="刷新缓存">
			<form id="queryForm" style="margin:5;text-align: center;">
			<table width="100%">
				<tr>
					<td>
					请选择需要刷新的缓存：
						<SELECT class="easyui-combogrid" 
										style="width:500px"
										name="cacheName"
										id="idCacheName"
										data-options="
												panelWidth: 500,
												idField:'cacheName',
												textField:'cacheName',
												multiple:true,
							            columns: [[
							                {field:'ck',checkbox:true},
							                {field:'cacheName',title:'Cache Name',width:100},
							            ]],
							            data:[
								                { cacheName: 'ApkInfo' },
												{ cacheName: 'BlackUserInfo' },
												{ cacheName: 'CpAppInfo' },
												{ cacheName: 'SpCode' },
												{ cacheName: 'SpCodeProvincePercent' },
												{ cacheName: 'SpCodeUserDateInfo' },
												{ cacheName: 'SpCodeUserMonthInfo' },
												{ cacheName: 'SpCodeInfo' },
												{ cacheName: 'CurrentDayProvinceTotalprice' },
												{ cacheName: 'CurrentUserTotalprice' },
												{ cacheName: 'CurrentuserCodeDayTotalprice' },
												{ cacheName: 'CurrentUserCodeMonthTotalPrice' },
												{ cacheName: 'SpCodeForPrice' },
												{ cacheName: 'ThirdSdkInfo' }
								                ],
							            fitColumns: true
										">
								</SELECT>
					</td>
					<td>
						<a href="#" onclick="redisRefresh();" class="easyui-linkbutton" iconCls="icon-search"><div style="width: 60px;float: left;">刷新缓存</div></a>
					</td>
				</tr>
			</table>
			</form>
		</div>
		
		<div data-options="region:'center'" style="padding:10; " id="tabdiv">
		</div>
		
	</body>
